/**
 * Created by steven on 2016/4/22.
 */
$("#showTooltips").on('click',function(){
    var username=$('#username').val();
    var password=$('#password').val();
    if(username.length<4){
        $('#dialog_info').html("用户名长度不能少于4个字符！");
        $('#weui_dialog_alert').show();
        return;
    }
    if(password.length<6){
        $('#dialog_info').html("密码长度不能少于6个字符！");
        $('#weui_dialog_alert').show();
        return;
    }
    var url='http://www.fddiaoyu.com/index.php/law_help/makelogin';
    var dt={
        username:username,
        password:password
    };
    var aj = $.ajax( {
        url:url,// 跳转到 action
        data:dt,
        type:'post',
        cache:false,
        dataType:'json',
        success:function(data) {
           var isSuccess=data.isSuccess;
            if(!isSuccess){
                giveAlert(data.errorMessage);
            }else{
                location.href = "index.php/law_help";
            }
          },
        error : function(XMLHttpRequest, textStatus, errorThrown) {
            alert(XMLHttpRequest.status);
            alert(XMLHttpRequest.readyState);
            alert(textStatus);
        }
     });
});

$("#dialog_check").on('click',function(){
    $('#weui_dialog_alert').hide();
});

function giveAlert(message){
    $('#dialog_info').html(message)
    $('#weui_dialog_alert').show();
}
